package system.data;

import java.util.*;

import framework.core.*;

/*
 Author    :Jackey
 CreateTime:2008-03-03 10:07:46
 */
public class OperateRecordBase extends Table {
	public static final String TABLE_NAME = "OPERATE_RECORD";

	private static final String BACKUP_TABLE_NAME = "OPERATE_RECORD_BACKUP";

	private static final String BACKUP_SEQ_NAME = "S_OPERATE_RECORD_BACKUP";

	public static final String ID = "ID";

	public static final String OPERATE_TYPE = "OPERATE_TYPE";
	
	public static final String OPERATE_CONTENT = "OPERATE_CONTENT";

	public static final String OPERATE_TIME = "OPERATE_TIME";
	
	public static final String OPERATE_USER_ID = "OPERATE_USER_ID";
	
	public static final String OPERATE_USER_NAME = "OPERATE_USER_NAME";
	
	public static final String RECORD_ID = "RECORD_ID";
	
	public static final String STATUS = "STATUS";
	
	public static final String REMARK = "REMARK";	
	

	public static Vector m_fields = null;

	private String m_id = ""; // 序号

	private String m_operate_type = ""; // 操作类型

	private String m_operate_content = "";// 操作内容

	private String m_operate_time = ""; // 操作时间

	private String m_operate_user_id = ""; // 操作人id
	
	private String m_operate_user_name = ""; // 操作人名称

	private String m_record_id = ""; // 操作记录id

	private String m_status = ""; // 是否有效
	
	private String m_remark = ""; // 备注

	public String getId() {
		return m_id;
	}

	public void setId(String v) {
		if (getId().equals(v))
			return;
		m_id = v;
		markDirty(ID);
	}


	public String getStatus() {
		return m_status;
	}

	public void setStatus(String v) {
		if (getStatus().equals(v))
			return;
		m_status = v;
		markDirty(STATUS);
	}
	
	public String getRemark() {
		return m_remark;
	}

	public void setRemark(String v) {
		if (getRemark().equals(v))
			return;
		m_remark = v;
		markDirty(REMARK);
	}

	public String getOperateType() {
		return m_operate_type;
	}

	public void setOperate_type(String v) {
		if (getOperateType().equals(v))
			return;
		m_operate_type = v;
		markDirty(OPERATE_TYPE);
	}

	public String getOperateContent() {
		return m_operate_content;
	}

	public void setOperate_content(String v) {
		if (getOperateContent().equals(v))
			return;
		m_operate_content = v;
		markDirty(OPERATE_CONTENT);
	}

	public String getOperateTime() {
		return m_operate_time;
	}

	public void setOperateTime(String v) {
		if (getOperateTime().equals(v))
			return;
		m_operate_time = v;
		markDirty(OPERATE_TIME);
	}

	public String getOperateUserId() {
		return m_operate_user_id;
	}

	public void setOperateUserId(String v) {
		if (getOperateUserId().equals(v))
			return;
		m_operate_user_id= v;
		markDirty(OPERATE_USER_ID);
	}

	public String getOperateUserName() {
		return m_operate_user_name;
	}

	public void setOperateUserName(String v) {
		if (getOperateUserName().equals(v))
			return;
		m_operate_user_name= v;
		markDirty(OPERATE_USER_NAME);
	}

	public String getRecordId() {
		return m_record_id;
	}

	public void setRecord_id(String v) {
		if (getRecordId().equals(v))
			return;
		m_record_id= v;
		markDirty(RECORD_ID);
	}


	public String viewId(DBConnection con) throws Exception {
		return Value.view(getId());
	}
	
	public String viewStatus(DBConnection con) throws Exception {
		return Value.view(getStatus());
	}

	protected OperateRecordBase() {
	}


	public String getTableName() {
		return TABLE_NAME;
	}

	public String getBackupTableName() {
		return BACKUP_TABLE_NAME;
	}

	public String getBackupSeqName() {
		return BACKUP_SEQ_NAME;
	}

	public java.util.Vector getFields() {
		if (m_fields == null) {
			m_fields = new Vector();

			m_fields.add(new Field(ID, Value.TYPE_STRING, false, true, 32, "序号"));

			m_fields.add(new Field(OPERATE_TYPE, Value.TYPE_STRING, false, true,
					32, "操作类型"));

			m_fields.add(new Field(OPERATE_CONTENT, Value.TYPE_STRING,
					false, true, 200, "操作内容"));

			m_fields.add(new Field(OPERATE_TIME, Value.TYPE_STRING, false,
					true, 32, "操作时间"));

			m_fields.add(new Field(OPERATE_USER_ID, Value.TYPE_STRING, false, true,
					32, "操作人ID"));

			m_fields.add(new Field(OPERATE_USER_NAME, Value.TYPE_STRING, false, true,
					20, "操作人姓名"));

			m_fields.add(new Field(RECORD_ID, Value.TYPE_STRING, false,
					true, 32, "记录ID"));

			m_fields.add(new Field(STATUS, Value.TYPE_STRING, false, true, 2,
					"是否启用"));
			
			m_fields.add(new Field(REMARK, Value.TYPE_STRING, false,
					true, 200, "备注"));

		}
		return m_fields;
	}

	public void initObject(java.sql.ResultSet rs) throws Exception {

		m_id = getString(rs, ID);
		
		m_operate_type = getString(rs, OPERATE_TYPE);
		
		m_operate_content = getString(rs, OPERATE_CONTENT);
		
		m_operate_time = getString(rs, OPERATE_TIME);

		m_operate_user_id = getString(rs, OPERATE_USER_ID);
		
		m_operate_user_name = getString(rs, OPERATE_USER_NAME);
		
		m_record_id = getString(rs, RECORD_ID);
		
		m_status = getString(rs, STATUS);

		m_remark = getString(rs, REMARK);
		
		ms_new_flag = ConstDefine.NO;
	}

	public Value get(String f) {

		if (f.equalsIgnoreCase(ID)) {
			return new Value(getId());
		}

		if (f.equalsIgnoreCase(OPERATE_TYPE)) {
			return new Value(getOperateType());
		}

		if (f.equalsIgnoreCase(OPERATE_CONTENT)) {
			return new Value(getOperateContent());
		}

		if (f.equalsIgnoreCase(OPERATE_TIME)) {
			return new Value(getOperateTime());
		}

		if (f.equalsIgnoreCase(OPERATE_USER_ID)) {
			return new Value(getOperateUserId());
		}

		if (f.equalsIgnoreCase(OPERATE_USER_NAME)) {
			return new Value(getOperateUserName());
		}

		if (f.equalsIgnoreCase(RECORD_ID)) {
			return new Value(getRecordId());
		}

		if (f.equalsIgnoreCase(STATUS)) {
			return new Value(getStatus());
		}
		
		if (f.equalsIgnoreCase(REMARK)) {
			return new Value(getRemark());
		}

		return null;
	}

	public void set(String f, Value v) throws Exception {

		if (f.equalsIgnoreCase(ID)) {
			setId(v.getString());
		}

		if (f.equalsIgnoreCase(OPERATE_TYPE)) {
			setOperate_type(v.getString());
		}

		if (f.equalsIgnoreCase(OPERATE_CONTENT)) {
			setOperate_content(v.getString());
		}

		if (f.equalsIgnoreCase(OPERATE_TIME)) {
			setOperateTime(v.getString());
		}

		if (f.equalsIgnoreCase(OPERATE_USER_ID)) {
			setOperateUserId(v.getString());
		}

		if (f.equalsIgnoreCase(OPERATE_USER_NAME)) {
			setOperateUserName(v.getString());
		}

		if (f.equalsIgnoreCase(RECORD_ID)) {
			setRecord_id(v.getString());
		}

		if (f.equalsIgnoreCase(STATUS)) {
			setStatus(v.getString());
		}

		if (f.equalsIgnoreCase(REMARK)) {
			setRemark(v.getString());
		}
	}

	public String toString() {
		String msg = "OperateRecord=\n";
		msg += "(\r\n";

		msg += "    序号(id)=" + get("id") + "\r\n";

		msg += "    操作类型(operate_type)=" + get("operate_type") + "\r\n";

		msg += "    操作内容(operate_content)=" + get("operate_content")
				+ "\r\n";

		msg += "    操作时间(operate_time)=" + get("operate_time") + "\r\n";

		msg += "    操作人id(operate_user_id)=" + get("operate_user_id") + "\r\n";

		msg += "    操作人姓名(operate_user_name)=" + get("operate_user_name") + "\r\n";

		msg += "    记录id(record_id)=" + get("record_id") + "\r\n";

		msg += "    状态(status)=" + get("status") + "\r\n";

		msg += "    备注(remark)=" + get("remark") + "\r\n";

		msg += ")\r\n";
		return msg;
	}

	public void copyBase(OperateRecordBase srcObj) {

		setId(srcObj.getId());

		setOperate_type(srcObj.getOperateType());
		
		setOperate_content(srcObj.getOperateContent());
		
		setOperateTime(srcObj.getOperateTime());
		
		setOperateUserId(srcObj.getOperateUserId());
		
		setOperateUserName(srcObj.getOperateUserName());
		
		setRecord_id(srcObj.getRecordId());
		
		setRemark(srcObj.getRemark());
		
		setStatus(srcObj.getStatus());
	}

	public String toXml() throws Exception {
		String xml = "";
		xml += "<OperateRecord>";

		xml += "<Id>" + Value.view(getId()) + "</Id>";


		xml += "<Status>" + Value.view(getStatus()) + "</Status>";

		xml += "</OperateRecord>";
		return xml;
	}

}
